home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / jam / jamdisk5 / conman / push.doc / push.doc
Text File  |  1995-03-18  |  2KB  |  53 lines

  1.                           PUSH, QUEUE, and DROPBUF
  2.  
  3. ConMan provides special capabilities (in versions 1.0 and later) that 
  4. allow an input stream to be used as a temporary "scratchpad" to store a 
  5. series of data lines.  These lines can be "stacked" (last in, first out) 
  6. or "queued" (first in, first out) to be read at a later time.  These
  7. special capabilities are available through the CLI command utilities
  8. PUSH, QUEUE, and DROPBUF.  Here's what they do:
  9.  
  10. PUSH takes its command line and "stacks" it in the input stream.  Stacked
  11. lines always go the the head of the internal buffer, and are then available 
  12. for the next program (or the CLI) that reads from the stream.  For example,
  13. entering "push echo hi" would result in 
  14.  
  15. 1> push echo hi
  16. 1> hi
  17. 1>
  18.  
  19. The command line can be surrounded by double-quotes to prevent the CLI
  20. from breaking it; the quotes are stripped off before the line is actually
  21. stacked.  PUSH is useful within an "execute" script to allow a series of
  22. responses to be prepared for a program.  For example, suppose that the
  23. program "myprog" expects three lines of input.  Then the following script
  24. could be used to launch the program:
  25.  
  26. ; Launch "myprog" with prepared data
  27. push data line 3
  28. push data line 2
  29. push data line 1
  30. df1:c/myprog -t
  31.  
  32. Note that the command lines are stacked in reverse order (well, in normal
  33. order if you're a Forth programmer).
  34.  
  35. The QUEUE command behaves just like the PUSH command, except that it 
  36. places the data in "first in, first out" order.  New data is placed behind
  37. all previously queued (or stacked) data.  The choice of whether to use 
  38. PUSH or QUEUE is usually just a matter of convenience, unless the data is
  39. available in a particular order that constrains the decision.
  40.  
  41. Data lines entered by PUSH or QUEUE are never displayed on the console,
  42. and are always ahead of any data received through the input stream.
  43.  
  44. Sometimes it may be necessary to delete or purge previously stacked data.
  45. For example, if a program aborted after reading only part of its prepared
  46. input stream, it would be confusing (or dangerous!) for the stacked data
  47. to be read from the command stream.  The DROPBUF command is provided to 
  48. "drop" (delete) all stacked or queued data, without perturbing any of the
  49. lines received through the input stream.  
  50.  
  51. Two brief demonstration scripts, "pushdemo" and "dropdemo", have been
  52. included as examples.  Type them out and then try "execute pushdemo".
  53.